package mvp.com.bbc.rcjavaretrofitdaggermvp.service;

import android.app.IntentService;
import android.content.Context;
import android.content.Intent;

import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;

import mvp.com.bbc.rcjavaretrofitdaggermvp.app.contact.PlatformConstant;

/**
 * Created by ${cbf} on 2017/11/24.
 */

public class InitializationService extends IntentService {
    public static final String InitializationAction = "All initialization operations are put into service";

    public InitializationService() {
        super("InitializationService");
    }

    public static void startinitialization(Context context) {
        Intent intent = new Intent();
        intent.setAction(InitializationAction);
        intent.setClass(context, InitializationService.class);
        context.startService(intent);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        if (intent != null) {
            String action = intent.getAction();
            if (InitializationAction.equals(action)) {
                //分享
                {
                    PlatformConfig.setWeixin(PlatformConstant.Weixin_id, PlatformConstant.Weixin_secret);
                    PlatformConfig.setQQZone(PlatformConstant.QQZone_id, PlatformConstant.QQZone_key);
                    PlatformConfig.setSinaWeibo(PlatformConstant.SinaWeibo_key, PlatformConstant.SinaWeibo_secret, PlatformConstant.SinaWeibo_redirectUrl);
                }
                //友盟分享
                UMShareAPI.get(this);
            }
        }

    }
}
